<template>
	<view class="invitationBgc">
		<view class="invitationBox">
			<view class="fillInvita">
				请填写邀请码
			</view>
			<view class="brief">
				向会员用户获取邀请码，即可获取更多特权
			</view>
			<input type="text" value="" placeholder="请输入邀请码" v-model="inviteCode" class="inputFont" />
			<view class="submitBtn" @click="submitBtn">
				确定
			</view>
		</view>
		<view class="bottomInvital">
			<view class="noHaveInvital">
				没有邀请码？
			</view>
			<view class="noHaveBrief">
				您可通过以下方式注册
			</view>
			<view class="registerBox me-fx-row-sb-c">
				<view class="register" @click="mianfeiBtn">
					免费注册
				</view>
				<view class="nowregister"@click="mashangBtn">
					马上注册
				</view>
			</view>
			<view class="perfectData">
				您只需完善下个人资料即可免费注册
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				inviteCode:'',
				objparameter:{}
			}
		},
		methods: {
			mianfeiBtn(){
				uni.navigateTo({
					url:'./perfectData'
				})
			},
			mashangBtn(){
				uni.navigateTo({
					url:'./perfectData'
				})
			},
			submitBtn(){
				if(this.inviteCode ==''){
					uni.showToast({
						title:'请填写邀请码',
						duration:1000,
						icon:'none'
					});
					return
				}
				uni.getStorage({
					key: 'item',
					success:(e)=> {
						console.log(e,'item')
						this.objparameter=e.data //这就是你想要取的token
					}
				})
				this.objparameter.invite_code=this.inviteCode
				uni.setStorage({
				    key: 'item',
				    data: this.objparameter,
				});
				this.$u.get('/user/invite_code/status/'+this.inviteCode).then(res => {
					if(res){
						uni.showToast({
							title:res.message,
							duration:1000,
							icon:'none'
						})
						setTimeout(()=>{
							uni.navigateTo({
								url:'./perfectData'
							})
						},1000)
					}
				}).catch((res) => {
					uni.showToast({
						title:res.message,
						duration:1000,
						icon:'none'
					})
				})
			}
		}
	}
</script>

<style>
	.invitationBgc {
		padding: 32rpx;
		margin-top: 60rpx;
	}

	.invitationBox {
		/* width: 682rpx; */
		height: 472rpx;
		background: rgba(255, 255, 255, 1);
		box-shadow: 0rpx 1rpx 13rpx 0rpx rgba(161, 121, 254, 0.2);
		border-radius: 8rpx;
		text-align: center;
	}

	.invitationBox .fillInvita {
		font-size: 34rpx;
		color: rgba(0, 0, 51, 1);
		padding-top: 37rpx;
		text-align: center;
		box-sizing: border-box;
	}

	.brief {
		font-size: 28rpx;
		color: rgba(153, 153, 153, 1);
		text-align: center;
		margin-top: 22rpx;
	}

	.inputFont {
		width: 618rpx;
		height: 88rpx;
		background: rgba(225, 213, 253, 1);
		opacity: 0.9;
		border-radius: 6rpx;
		text-align: center;
		margin: 46rpx auto 75rpx;
	}

	.submitBtn {
		width: 428rpx;
		height: 88rpx;
		background: rgba(91, 19, 255, 1);
		border-radius: 44rpx;
		margin: auto;
		font-size:36rpx;
		font-weight:bold;
		color:rgba(255,255,255,1);
		line-height:88rpx;
	}
	.bottomInvital{
		/* width:682rpx; */
		height:433rpx;
		background:rgba(255,255,255,1);
		box-shadow:0rpx 1rpx 13rpx 0rpx rgba(161,121,254,0.2);
		border-radius:8rpx;
		margin: 60rpx auto;
	}
	.noHaveInvital{
		font-size:34rpx;
		font-weight:400;
		color:rgba(0,0,51,1);
		line-height:64rpx;
		text-align: center;
	}
	.noHaveBrief{
		font-size:28rpx;
		font-family:PingFang SC;
		font-weight:400;
		color:rgba(153,153,153,1);
		line-height:64rpx;
		text-align: center;
	}
	.registerBox{
		padding: 0 32rpx 40rpx;
		margin-top: 62rpx;
		border-bottom: 1rpx solid rgba(245,245,245,1);
		box-sizing: border-box;
	}
	.registerBox .nowregister{
		width:326rpx;
		height:88rpx;
		background:rgba(92,20,255,1);
		border-radius:44rpx;
		font-size:36rpx;
		font-weight:bold;
		color:rgba(255,255,255,1);
		line-height:88rpx;
		text-align: center;
	}
	.registerBox .register{
		font-size:3r6px;
		font-weight:400;
		color:rgba(92,20,255,1);
		line-height:64rpx;
	}
	.perfectData{
		font-size:28rpx;
		font-weight:400;
		color:rgba(68,68,68,1);
		line-height:64rpx;
		text-align: center;
	}
	
</style>
